import Vue from 'vue'
import Vuex from 'vuex'

import actions from './actions'
import mutations from './mutations'

Vue.use(Vuex)

// 防止用户开启隐身模式
let defaultCity = '北京'
try {
  if (localStorage.city) {
    defaultCity = localStorage.city
  }
} catch (error) {
  console.log(error)
}

const store = new Vuex.Store({
  state: {
    city: defaultCity
  },
  actions,
  mutations
})

export default store
